<style>
  * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
  }
  /* 进度条 */
  .out {
    width: 300px;
    height: 20px;
    border: 1px solid red;
    border-radius: 20px;
  }
  .in {
    width: 50%;
    height: 100%;
    background-color: red;
    border-radius: inherit;
    /* 过渡效果 */
    transition: all 2.5s;
  }
  .out:hover .in {
    width: 100%;
  }
  /* 背景平移 */
  .box {
    overflow: hidden;
    width: 100px;
    height: 100px;
    margin-top: 100px;
    background-color: skyblue;
  }
  .content {
    width: 200%;
    height: 100%;
    /* 过渡效果 */
    transition: all 0.5s;
  }
  span {
    float: left;
    width: 100px;
    height: 100%;
  }
  .one {
    background-color: orange;
  }
  .two {
    background-color: purple;
  }
  .content:hover {
    margin-left: -100px;
  }
</style>

<!-- 进度条 -->
<div class="out">
  <div class="in"></div>
</div>

<!-- 背景平移 -->
<div class="box">
  <div class="content">
    <span class="one">one</span>
    <span class="two">two</span>
  </div>
</div>
